<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePaperTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('paper', function (Blueprint $table) {
            //自增主键id
            $table->increments('id');
            //试卷名称,唯一, varchar(100), 不为空
            $table->string('paper_name','100')->notNull()->unique();
            // 试卷总分数 整型数字 tinyint 默认为 100
            $table->tinyInteger('total_score')->default(100);
            //开始考试时间 时间戳类型 整型int
            $table->integer('start_time')->nullable();
            //考试时长. 单位分钟,整型tinyint
            $table->tinyInteger('duration');
            //试卷是否启用状态, 1表示启用, 2表示禁用,默认为1 , tinyint
            $table->tinyInteger('status')->default(1);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('paper');
    }
}
